Skip to content

Conversation

@HaavardRei
Copy link
Contributor

@HaavardRei HaavardRei commented Nov 20, 2025

Adds the CONFIG_BT_SMP_LEGACY_PAIR_ONLY Kconfig option to force devices to use legacy pairing. This has a dependency on CONFIG_BT_TESTING as it is only intended for testing purposes, and use of legacy pairing is discouraged.

jhedberg
jhedberg previously approved these changes Nov 20, 2025

config BT_SMP_ENFORCE_LEGACY_PAIRING
bool "Enforce legacy pairing"
depends on BT_TESTING
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not allowed to only support legacy pairing in recent version of the core spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's allowed, but since Zephyr 3.0 the use of legacy pairing has been discouraged for being less/not secure, so I didn't want this Kconfig to imply otherwise. Zephyr-devices support legacy pairing with devices that do not support secure connections, but since Zephyr-devices do support it they will always default to this (and thus this config is needed to force it).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should allow setting this without BT_TESTING, but treat it as a warning for the above reasons. That would be similar to how we treat e.g. BT_USE_DEBUG_KEYS, where we have both Kconfig and CMake warnings if it's enabled.

Alternatively we should consider adding the same depends on BT_TESTING for things like BT_USE_DEBUG_KEYS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both suggestions are fine by me, do you have any thoughts @jhedberg?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think depends on BT_TESTING is the right way. BT_USE_DEBUG_KEYS should have it as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhedberg Should we apply depends on BT_TESTING for all the other similar configs? And then if we do, should we remove the warning for them as well, and add/keep only a warning for BT_TESTING?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to add the dependency on BT_TESTING to all relevant configs, keeping the warnings in the Kconfig file (but remove the CMakeList warnings and add a common one for BT_TESTING?).

Adds the `CONFIG_BT_SMP_LEGACY_PAIR_ONLY` Kconfig option to force
devices to use legacy pairing. This has a dependency on
`CONFIG_BT_TESTING` as it is only intended for testing purposes, and use
of legacy pairing is discouraged.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
@sonarqubecloud
Copy link

@Thalley Thalley requested a review from Copilot November 21, 2025 14:09
Copilot finished reviewing on behalf of Thalley November 21, 2025 14:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the CONFIG_BT_SMP_LEGACY_PAIR_ONLY Kconfig option to enable testing of legacy Bluetooth pairing between Zephyr devices. The option forces devices to use legacy pairing instead of defaulting to Secure Connections pairing.

Key Changes:

  • New test-only Kconfig option with appropriate dependencies on CONFIG_BT_TESTING and mutual exclusion with Secure Connections modes
  • Updates to SMP authentication default flags to exclude Secure Connections when legacy pairing is forced
  • Modification to le_sc_supported() function to return false when the new config is enabled

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
subsys/bluetooth/host/Kconfig Adds CONFIG_BT_SMP_LEGACY_PAIR_ONLY option with proper dependencies and clear documentation for testing purposes
subsys/bluetooth/host/smp.c Updates macro definitions and le_sc_supported() function to disable Secure Connections support when legacy pairing is forced

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HaavardRei HaavardRei requested a review from jhedberg November 24, 2025 08:54
@kartben kartben merged commit 6bb0e98 into zephyrproject-rtos:main Nov 24, 2025
37 checks passed
@HaavardRei HaavardRei deleted the legacy_pairing_test_config branch November 25, 2025 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants